import java.util.ArrayList;

/**
 * Class implementing ingredients
 */
public class Ingredient extends Predicate {
	private String name;
	
	/**
	 * Constructor for the Ingredient clas
	 * @param name Name of the ingredient
	 */
	public Ingredient(String name) {
		this.name = name;
		lstObjects = new ArrayList<Predicate>();
	}
	
	/**
	 * Returns the name of the ingredient
	 * @return
	 */
	public String getName() { return name; }
	
	/**
	 * Method for comparing Ingredients, using ingredient
	 * names as comparison
	 */
	public boolean equals(Predicate p) {
		if (!(p instanceof Ingredient))
			return false;
		
		Ingredient i = (Ingredient) p;
		
		return i.getName().compareTo(name) == 0;
	}
	
	public boolean equals2(Predicate p) {
		return equals(p);
	}
	
	/**
	 * Returns a string representation of the ingredient
	 */
	public String toString() {
		return name;
	}
}